package cn.item.buckle.business.service.impl;

import cn.item.buckle.business.dao.MonitorCameraStateMapper;
import cn.item.buckle.business.pojo.*;
import cn.item.buckle.business.service.MonitorCameraStateService;
import cn.lsh.kafka.db.service.BaseService;
import org.apache.ibatis.session.SqlSession;

public class MonitorCameraStateServiceImpl extends BaseService<MonitorCameraStateMapper> implements MonitorCameraStateService {

	public MonitorCameraStateServiceImpl(SqlSession sqlSession) {
		super(sqlSession);
	}

	@Override
	public int insert(MonitorCameraState monitorCameraState) {
		return this.mapper.insert(monitorCameraState);
	}

	@Override
	public int insert(MonitorFlowAction monitorFlowAction) {
		return this.mapper.insertCarInfo(monitorFlowAction);
	}

	@Override
	public int insert(MonitorCarCount monitorCarCount) {
		return this.mapper.insertCarCount(monitorCarCount);
	}

	@Override
	public int insert(MonitorCarSpeedCount monitorCarSpeedCount) {
		return this.mapper.insertCarSpeedCount(monitorCarSpeedCount);
	}

	@Override
	public <T> int insert(T t) {
		int i;
		if (t instanceof MonitorCameraState) {
			i = this.mapper.insert((MonitorCameraState) t);
		} else if (t instanceof TakeCarAction) {
			i = this.mapper.insertTakeCarAction((TakeCarAction) t);
		} else if (t instanceof MonitorFlowAction) {
			i = this.mapper.insertCarInfo((MonitorFlowAction) t);
		} else if (t instanceof MonitorCarCount) {
			i = this.mapper.insertCarCount((MonitorCarCount) t);
		} else if (t instanceof MonitorCarSpeedCount) {
			i = this.mapper.insertCarSpeedCount((MonitorCarSpeedCount) t);
		} else if (t instanceof MonitorCarTrack) {
			i = this.mapper.insertCarTrack((MonitorCarTrack) t);
		} else if (t instanceof MonitorCarArea) {
			i = this.mapper.insertCarArea((MonitorCarArea) t);
		} else if (t instanceof MonitorCarConversionRate) {
			i = this.mapper.insertConversionRate((MonitorCarConversionRate) t);
		} else {
			throw new RuntimeException("未知的POJO对象");
		}
		return i;
	}
}
